/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.swta.freezay.database.dbEntities.copy;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Christian Baeumer
 */
@Entity
@Table(name = "RESERVATION")
@NamedQueries({@NamedQuery(name = "Reservation.findAll", query = "SELECT r FROM Reservation r"), @NamedQuery(name = "Reservation.findByReservationNr", query = "SELECT r FROM Reservation r WHERE r.reservationNr = :reservationNr"), @NamedQuery(name = "Reservation.findByPackagecount", query = "SELECT r FROM Reservation r WHERE r.packagecount = :packagecount"), @NamedQuery(name = "Reservation.findByValidity", query = "SELECT r FROM Reservation r WHERE r.validity = :validity")})
public class Reservation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name = "RESERVATION_NR")
    private Integer reservationNr;
    @Basic(optional = false)
    @Column(name = "PACKAGECOUNT")
    private int packagecount;
    @Basic(optional = false)
    @Column(name = "VALIDITY")
    @Temporal(TemporalType.TIMESTAMP)
    private Date validity;
    @JoinColumn(name = "PACKAGE", referencedColumnName = "ID")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Package package1;

    public Reservation() {
    }

    public Reservation(Integer reservationNr) {
        this.reservationNr = reservationNr;
    }

    public Reservation(Integer reservationNr, int packagecount, Date validity) {
        this.reservationNr = reservationNr;
        this.packagecount = packagecount;
        this.validity = validity;
    }

    public Integer getReservationNr() {
        return reservationNr;
    }

    public void setReservationNr(Integer reservationNr) {
        this.reservationNr = reservationNr;
    }

    public int getPackagecount() {
        return packagecount;
    }

    public void setPackagecount(int packagecount) {
        this.packagecount = packagecount;
    }

    public Date getValidity() {
        return validity;
    }

    public void setValidity(Date validity) {
        this.validity = validity;
    }

    public Package getPackage1() {
        return package1;
    }

    public void setPackage1(Package package1) {
        this.package1 = package1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reservationNr != null ? reservationNr.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Reservation)) {
            return false;
        }
        Reservation other = (Reservation) object;
        if ((this.reservationNr == null && other.reservationNr != null) || (this.reservationNr != null && !this.reservationNr.equals(other.reservationNr))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "de.swta.freezay.database.dbEntities.Reservation[reservationNr=" + reservationNr + "]";
    }

}
